#----------------------------------*-sh-*--------------------------------------
# =========                 |
# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
#  \\    /   O peration     |
#   \\  /    A nd           | www.synthetik-technologies.com
#    \\/     M anipulation  |
#------------------------------------------------------------------------------
#     Copyright (C) 2020 Synthetik Applied Technologies
#------------------------------------------------------------------------------
# License
#     This file is derivative work of OpenFOAM.
#
#     OpenFOAM is free software: you can redistribute it and/or modify it
#     under the terms of the GNU General Public License as published by
#     the Free Software Foundation, either version 3 of the License, or
#     (at your option) any later version.
#
#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
#     for more details.
#
#     You should have received a copy of the GNU General Public License
#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
#
# File
#     etc/bashrc
#
# Description
#     Startup file for blastFoam
#     Sourced from ~/.profile or ~/.bashrc
#     Should be usable by any POSIX-compliant shell (eg, ksh)
#
#------------------------------------------------------------------------------

# Some compatibility methods (OPENFOAM-v2012 and later or Oct-2020 develop)
export FOAM_EXTRA_CXXFLAGS="-DCOMPAT_OPENFOAM_ORG"

################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
#
# BLAST_DIR is the location of the blastfoam installation which defaults to
# the directory containing this file if sourced by a bash shell.
# Set to one directory level higher than the current by default

# For linux

export BLAST_DIR="$( cd $(dirname ${BASH_SOURCE[0]})/../ && pwd )"
# For mac
# export BLAST_DIR="$( cd $(dirname $0)/../ && pwd )"

# Export location of libraries and executables
if [[ $MAKE = True || -d "/opt/blastfoam" ]]
then
    export BLAST_LIBBIN="${BLAST_DIR}/lib"
    export BLAST_APPBIN="${BLAST_DIR}/bin"
else
    export BLAST_LIBBIN="$FOAM_USER_LIBBIN"
    export BLAST_APPBIN="$FOAM_USER_APPBIN"
fi
#export BLAST_LIBBIN="$FOAM_SITE_LIBBIN"
#export BLAST_APPBIN="$FOAM_SITE_APPBIN"

# Add BLAST_APPBIN to the PATH if it isn't already on it
if [[ ":$PATH:" != *":$BLAST_APPBIN:"* ]]; then
    PATH=$PATH:$BLAST_APPBIN
fi
# Add BLAST_LIBBIN to the LD_LIBRARY_PATH if it isn't already on it
if [[ ":$LD_LIBRARY_PATH:" != *":$BLAST_LIBBIN:"* ]]; then
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BLAST_LIBBIN
fi

export BLAST_CODE_TEMPLATES="$BLAST_DIR/etc/codeTemplates"
#------------------------------------------------------------------------------
